import { connect } from 'react-redux'
import {clearCompleted, setVisibilityFilter} from '../redux/action'
import Footer from '../components/Footer'
import { getCompletedTodoCount } from '../selectors'

const mapStateToProps = state => ({
    completedCount: getCompletedTodoCount(state),
    activeCount: state.todos.length - getCompletedTodoCount(state),
    filterType: state.filter
})

const mapDispatchToProps = {
    onClearCompleted: clearCompleted,
    onFilter: setVisibilityFilter
}

export default connect(
    mapStateToProps,
    mapDispatchToProps
)(Footer)